<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>滴滴法律</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/my-style.css">
	<!--[if lt IE 9]> 
		<script src="js/html5shiv.min.js"></script> 
	<![endif]-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript">
		$(function() {
			var name_rul = /^[\u4e00-\u9fa5]{2,5}$/;
			var mail_rul = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+$/;
			var number_rul = /^[0-9]{6}$/;
			var office_rul = /^.{4,12}$/;
			var address_rul = /^.{6,30}$/;
			$("#province").change(function(){
				   $("#city option:not(:first)").remove();
				   var provinceId = $(this).val();
				   var url = "lawyer/province";
				   var args = {"provinceId":provinceId,"time":new Date()};
				   $.getJSON(url,args,function(data){
				   			for(var i=0;i<data.citys.length;i++){
				   					var cityId = data.citys[i].cityId;
				   					var city = data.citys[i].city;
				   					$("#city").append("<option value='"+cityId+"'>"+city+"</option>");
				   			}
				   });
			});
			
			$("#lawyer-apply").click(function(){
				   var name = $("#name").val();
				   var mail = $("#mail").val();
				   var operationnum = $("#operationnum").val();
				   var lawoffice = $("#lawoffice").val();
				   var officeaddress = $("#officeaddress").val();
				   var province = $("select[name=province] option").not(function(){ return !this.selected; }).val();
				   var city = $("select[name=city] option").not(function(){ return !this.selected; }).val();
				   var specialA = $("select[name=speciala] option").not(function(){ return !this.selected; }).val();
				   var specialB = $("select[name=specialb] option").not(function(){ return !this.selected; }).val();
				   var specialC = $("select[name=specialc] option").not(function(){ return !this.selected; }).val();
				   var membership = $("select[name=membership] option").not(function(){ return !this.selected; }).val();
				   var flag = true;
				   if(name == ""){
						alert("请输入名字!");
						flag = false;
					}else if(!name_rul.test(name)){
						alert("请输入合法的名字!");
						flag = false;
					}else if(mail == ""){
						alert("请输入邮箱地址!");
						flag = false;
					}else if(!mail_rul.test(mail)){
						alert("请输入合法的邮箱地址!");
						flag = false;
					}else if(operationnum==""){
						alert("请输入执业编号!");
						flag = false;
					}else if(!number_rul.test(operationnum)){
						alert("请输入合法的执业编号!");
						flag = false;
					}else if(province==0){
						alert("请选择省份!");
						flag = false;
					}else if(city == 0){
						alert("请选择地区!");
						flag = false;
					}else if(specialA==0 & specialB==0 & specialC==0){
						alert("请选择至少一个专长!");
						flag = false;
					}else if(membership==0){
						alert("请选择年限!");
						flag = false;
					}else if(lawoffice==""){
						alert("请输入律所!");
						flag = false;
					}else if(!office_rul.test(lawoffice)){
						alert("请输入合法的律所!");
						flag = false;
					}else if(officeaddress==""){
						alert("请输入律所地址!");
						flag = false;
					}else if(!address_rul.test(officeaddress)){
						alert("请输入合法的律所地址!");
						flag = false;
					}
				   if(flag){
							$("#apply-form").submit();
				 	}
			});
		});
</script>
</head>
<body>
	<!-- 导航栏 -->
	<header>
		<nav class="navbar navbar-inverse">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
		      <a class="navbar-brand" href="index.html">
		        <img alt="LOGO" src="img/50x30.png">
		      </a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-1">
					<ul class="nav navbar-nav navbar-left">
						   <li><a href="index/home">首页</a></li>
				          <li><a href="lawyer/list">法律人</a></li>
				          <li><a href="contract/list">法律产品</a></li>
				          <li><a href="knowledge/index">法律知识</a></li>
				          <li><a href="#">招聘</a></li>
					</ul>

					<ul class="nav navbar-nav navbar-right">
						<li class="law-cur"><a class="add-btn" href="index/join">法律人入驻<span class="caret"></span></a></li>
	          <li><a href="login.html">登录</a></li>
	          <li><a href="register.html">注册</a></li>
					</ul>
				</div>
			</div>
		</nav>
	</header>
	

	<section>
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<h3>欢迎即将加入我们的律师伙伴</h3>
					<p class="text-muted"><small>请花费3分钟完善以下资料,我们会尽快审核</small></p>
					<hr/>
				</div>
			</div>
			<div class="row">
				<div class="col-md-7 col-sm-7 col-xs-12">		
					<form class="form-horizontal vertical-hr" method="post" id="apply-form">

					  <h4 class="law-reg-title">基本信息</h4>
						<div class="form-group">
							<div class="col-md-6 col-sm-6">
								 <input type="text" class="form-control" id="name" placeholder="填写您的真实姓名" name="name">
							</div>							
						</div>
						<div class="form-group">
							<label class="col-md-2 control-label" style="text-align:center;">性别</label>
							<div class="col-md-4">	
							  <label class="radio-inline" style="margin-right:30px;">
							    <input type="radio" name="sex" id="man" value="1" checked>男							    
							  </label>
							  <label class="radio-inline">
							    <input type="radio" name="sex" id="woman" value="2">女							    
							  </label>	
							</div>
						</div>
						<div class="form-group">
							<div class="col-md-6 col-sm-6">
								 <input type="text" class="form-control" id="mail" placeholder="填写您的邮箱" name="mail">
							</div>							
						</div>



						<h4 class="law-reg-title">执业信息</h4>

						<div class="form-group">
							<div class="col-md-6 col-sm-6">
								 <input type="text" class="form-control" id="operationnum" placeholder="填写您执业号码" name="operationnum">
							</div>
						</div>
						

						<div class="form-group">
							<div class="col-sm-3">
								 <select class="form-control" id="province" name="province">
									  <option value="0">请选择省市</option>
									  <option value="1">山西</option>
									  <option value="2">天津</option>
								</select>
							</div>
							<div class="col-sm-3">
								 <select class="form-control" id="city" name="city">
								  	<option value="0">请选择市区</option>
								</select>
							</div>
						</div>


						<div class="form-group">
							<div class="col-sm-3">
								 <select class="form-control" name="speciala">
								  <option value="0">请选择服务类型</option>
								  <c:forEach items="${lawyerTypes}" var="specialA">
								  			<option value="${specialA.serviceid}">${specialA.name}</option>
								  </c:forEach>
								</select>
							</div>
							<div class="col-sm-3">
								 <select class="form-control" name="specialb">
								   <option value="0">请选择服务类型</option>
								  <c:forEach items="${lawyerTypes}" var="specialA">
								  			<option value="${specialA.serviceid}">${specialA.name}</option>
								  </c:forEach>
								</select>
							</div>
							<div class="col-sm-3">
								 <select class="form-control" name="specialc">
								    <option value="0">请选择服务类型</option>
								  	<c:forEach items="${lawyerTypes}" var="specialA">
								  			<option value="${specialA.serviceid}">${specialA.name}</option>
								  	</c:forEach>
								</select>
							</div>
						</div>
						
						<div class="form-group">
							<div class="col-md-6 col-sm-6">
									<select class="form-control" name="membership">
											    <option value="0">请选择年限</option>
											    <option value="1">5年以下</option>
											    <option value="2">5~10年</option>
											    <option value="3">10年以上</option>
									</select>
							</div>
						</div>
						<div class="form-group">
							<div class="col-md-6 col-sm-6">
								 <input type="text" class="form-control" id="lawoffice" placeholder="填写您的律所" name="lawoffice">
							</div>
						</div>


						<div class="form-group">
							<div class="col-md-6 col-sm-6">
								 <input type="text" class="form-control" id="officeaddress" placeholder="填写您的律所地址" name="officeaddress">
							</div>
						</div>



						<div class="form-group">
					    <div class="col-sm-8">
					      <div class="checkbox">
					        <label>
					          <input type="checkbox" id="">我已阅读并同意
					        </label>
					        <a href="#">《滴滴法律问答服务条款》</a>和<a href="#">《律师服务协议》</a>
					      </div>
					    </div>
					  </div>
					  <div class="form-group">
					    <div class="col-md-6 col-sm-6">
					      <button type="button" class="btn btn-success btn-lg" id="lawyer-apply">注册</button>
					    </div>
					  </div>
					</form>
				</div>
				<div class="col-md-6 col-sm-6 hidden-xs">
					
				</div>
			</div>
		</div>
	</section>



	
</body>
</html>